#include "hplcinjectprogram.h"

HplcInjectProgram::HplcInjectProgram(QObject *parent)
    : QObject(parent)
{

}

void HplcInjectProgram::setFlow(double flow)
{
    m_flow = flow;
}

double HplcInjectProgram::getFlow()
{
    return m_flow;
}

void HplcInjectProgram::setTime(double second)
{
    m_time = second;
}

double HplcInjectProgram::getTime()
{
    return m_time;
}

void HplcInjectProgram::setTickPeriod(double period)
{
    m_tickPeriod = period;
}

bool HplcInjectProgram::isStart()
{
    return m_isStart;
}

bool HplcInjectProgram::isTimeout()
{
    return (m_tick >= m_time);
}

void HplcInjectProgram::onTick()
{
    if (!m_isStart)
        return;

    m_tick += m_tickPeriod;
}

void HplcInjectProgram::start()
{
    m_isStart = true;
    m_tick = 0;
}

void HplcInjectProgram::stop()
{
    m_isStart = false;
}
